<template>
  <!-- 1 zeh订单列表 -->
  <div class="breadcrumb">
    <Breadcrumb :aaa="aaa" :msgg="msg" :txt="txt" :path1="path1" />
  </div>
  <div class="con_container">
    <div>
      <el-card class="box-card">
        <div style="display: flex; justify-content: space-between">
          <div>
            <p>筛选搜索</p>
          </div>
          <div>
            <el-button @click="reactchongzhi">重置</el-button>
            <el-button type="primary" @click="seach">查询搜索</el-button>
          </div>
        </div>
        <div style="margin-bottom: 20px">
          <div
            style="
              display: flex;
              padding-left: 50px;
              justify-content: flex-start;
              flex-wrap: wrap;
            "
          >
            <el-form-item label="输入搜索">
              <el-input v-model="form.dataid" style="width: 213px" />
            </el-form-item>
            <el-form-item label="提交时间">
              <el-date-picker
                v-model="value1"
                type="datetime"
                placeholder="请选择时间"
              />
            </el-form-item>
            <el-form-item label="订单分类">
              <el-select
                v-model="value2"
                class="m-2"
                placeholder="全部"
                size="large"
              >
                <el-option value="正常订单"></el-option>
                <el-option value="秒杀订单"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="收货人">
              <el-input v-model="form.phone" style="width: 213px" />
            </el-form-item>
            <el-form-item label="订单状态">
              <el-select
                v-model="value3"
                class="m-2"
                placeholder="全部"
                size="default"
              >
                <el-option value="待发货"></el-option>
                <el-option value="已发货"></el-option>
                <el-option value="已完成"></el-option>
                <el-option value="已关闭"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="订单来源">
              <el-select
                v-model="value3"
                class="m-2"
                placeholder="全部"
                size="default"
              >
                <el-option value="PC订单"></el-option>
                <el-option value="App订单"></el-option>
              </el-select>
            </el-form-item>
          </div>
        </div>
      </el-card>
      <el-card style="margin: 20px 0">
        <p>数据列表</p>
      </el-card>
    </div>
    <div>
      <el-table :data="tableData" border style="width: 100%">
        <!-- 多选框 -->
        <el-table-column
          type="selection"
          fixed
          select-on-indeterminate
          width="60"
        >
        </el-table-column>
        <!-- <el-table-column prop="date" label="Date" width="180" /> -->
        <el-table-column prop="name" label="编号" width="180" />
        <el-table-column prop="address" label="订单编号" />
        <el-table-column prop="address" label="提交时间" />
        <el-table-column prop="address" label="用户账户" width="400" />
        <el-table-column prop="address" label="订单金额" />
        <el-table-column prop="address" label="支付方式" />
        <el-table-column prop="address" label="订单来源" />
        <el-table-column prop="address" label="订单状态" />
        <el-table-column prop="address" label="操作" />
      </el-table>
    </div>
    <!-- 分页器 -->
    <div
      style="display: flex; justify-content: space-between; margin-top: 10px"
    >
      <div>
        <el-select
          v-model="value2"
          class="m-2"
          placeholder="批量发货"
          size="large"
        >
          <el-option value="批量发货"></el-option>
          <el-option value="关闭订单"></el-option>
          <el-option value="删除订单"></el-option>
        </el-select>
        <el-button type="primary" @click="caozuo" style="margin-left: 20px"
          >确定</el-button
        >
      </div>
      <div>
        <el-pagination
          v-model:current-page="pagination.pageNum"
          v-model:page-size="pagination.pageSize"
          background
          :page-sizes="[1, 5, 10, 20]"
          layout="total, sizes, prev, pager, next, jumper"
          :total="pagination.total"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
        />
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import * as api from "../../request/api";
import useTable from "../../hooks/useTables";
import { ElMessage } from "element-plus";
import { reactive, ref } from "vue";
import Breadcrumb from "../../components/breadcrumb.vue";
let msg = ref("订单列表");
let txt = ref("订单");
let path1 = ref("oms/order");
let aaa = ref(0);

const value1 = ref("");
const value2 = ref("");
const value3 = ref("");
const form = reactive({
  dataid: "",
  phone: "",
  hour: "",
});
let {
  tableData,
  getTableData,
  pagination,
  handleSizeChange,
  handleCurrentChange,
} = useTable(api.order.orderlist);

let seach = () => {
  let haha = api.order.orderlist();
  console.log(haha);
};
let reactchongzhi = () => {
  value1.value = "";
  value2.value = "";
  value3.value = "";
  form.dataid = "";
  form.hour = "";
  form.phone = "";
};
let caozuo = () => {
  ElMessage({
    showClose: true,
    message: "请选择要操作的订单",
    type: "warning",
  });
};
</script>

<style lang="scss" scoped>
.breadcrumb {
  height: 45px;
  border-bottom: 1px solid #ebeef5;
  font-size: 20px;
}

.con_container {
  padding: 10px 20px !important;
  margin-top: 25px !important;
}
</style>
